package nombreHilo;


public class ThreadBasico extends Thread {
     private int num;
     private boolean continuar;
public ThreadBasico (String nombre, int nu) {
  super(nombre);
   this.num = nu;
   continuar=true;
} 

    @Override
public void run() {
 try {
    while(continuar){
     //for(int i =0 ;i < this.num;i++) {
       System.out.println (this.getName()+"--- "+num++);
       sleep( (long) (Math.random()*400));
    } 
 } catch (InterruptedException e) {} 
} 
public void terminar(){
    continuar=false;
}
}  